package com.addzero.kmp.context



data class Settings(
   val skipExistsFiles: String = "false",
   val isomorphicOutputDir: String = "shared/src/commonMain/kotlin/com/addzero/kmp/isomorphic",
   val isomorphicPackageName: String = "com.addzero.kmp.isomorphic",
   val isomorphicClassSuffix: String = "Iso",
)

/**
 * 全局配置上下文
 */
object SettingContext {

    lateinit var settings: Settings

    val context: Settings
        get() = settings

    /**
     * 初始化配置
     * @param op gradle/ksp传入的options
     */
    fun initialize(op: Map<String, String>) {
        settings = Settings(
            skipExistsFiles = op["skipExistsFiles"] ?:"false",
            isomorphicOutputDir = op["isomorphicOutputDir"] ?:"shared/src/commonMain/kotlin/com/addzero/kmp/isomorphic",
            isomorphicPackageName = op["isomorphicPackageName"] ?:"com.addzero.kmp.isomorphic",
            isomorphicClassSuffix = op["isomorphicClassSuffix"] ?:"Iso",
        )
    }
}
